﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	xmlns:n="http://nRoute/schemas/2010/xaml"
	xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
    x:Class="nRoute.Samples.FutureDesktop.Views.FuturePage"
    d:DesignWidth="900" d:DesignHeight="600"
	>

    <!-- RESOURCES -->
    <UserControl.Resources>
        <n:ValueConverterRelay x:Key="DateTimeConverter" />
        <n:ValueConverterRelay x:Key="UserColorConverter" />        
    </UserControl.Resources>

    <!-- RESOURCES -->
    <i:Interaction.Behaviors>
		<n:BridgeViewModelBehavior/>
	</i:Interaction.Behaviors>

   <!-- CONTENT -->
    <ScrollViewer Height="Auto" Width="Auto" BorderThickness="0,0,0,0" VerticalScrollBarVisibility="Auto" 
                  BorderBrush="{x:Null}" Padding="0,0,0,0">

		<Grid x:Name="LayoutRoot" Background="White" Height="Auto" Width="Auto">
            
            <!-- TITLE -->
			<Grid Background="{x:Null}" Margin="0,0,0,0" Height="100" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                
                <!-- LINE -->
				<Rectangle Height="4" Margin="8,36,8,0" VerticalAlignment="Top" Fill="#FF463E33" Stroke="{x:Null}" 
                           StrokeThickness="0"/>
                
                <!-- TITLE -->
				<Border Height="49" Margin="19,44,0,0" VerticalAlignment="Top" Width="630" HorizontalAlignment="Left">
					<TextBlock Height="Auto" Text="{Binding Title, Mode=OneWay}" FontFamily="Trebuchet MS" FontSize="42" TextWrapping="NoWrap" TextTrimming="WordEllipsis" />
				</Border>
                
                <!-- DATE -->
				<TextBlock Height="Auto" HorizontalAlignment="Left" Margin="18,18,0,0" VerticalAlignment="Top" Width="Auto" 
					Text="{Binding Converter={StaticResource DateTimeConverter}}"
					TextWrapping="NoWrap" FontFamily="Arial" FontSize="14"/>
			</Grid>
            
            <!-- SQUARES -->
			<Grid Height="160" Margin="10,100,10,0" VerticalAlignment="Top" 
				  d:LayoutOverrides="VerticalAlignment"  HorizontalAlignment="Left" Cursor="Hand">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="160"/>
					<ColumnDefinition Width="160"/>
					<ColumnDefinition Width="160"/>
					<ColumnDefinition Width="160"/>
					<ColumnDefinition Width="*"/>
				</Grid.ColumnDefinitions>
                
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="MouseLeftButtonUp">
						<n:ExecuteCommandAction Command="{Binding ChangeColourCommand, Mode=OneWay}"/>
					</i:EventTrigger>
				</i:Interaction.Triggers>
                
                <!-- SQUARE 1 -->
				<Border Margin="5,5,5,5" BorderBrush="#FF000000" Width="150" Height="150" 
                        Background="{Binding UserColor, Mode=OneWay, Converter={StaticResource UserColorConverter}}">
					<TextBlock Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" 
                               FontSize="110" Foreground="{StaticResource ForegroundLight1ColourBrush}" Text="Ä" 
                               TextWrapping="Wrap" FontFamily="Webdings"/>
				</Border>
                
                <!-- SQUARE 2 -->
                <Border Margin="5,5,5,5" Grid.Column="1" BorderBrush="#FF000000" Width="150" Height="150"
                        Background="{Binding UserColor, Mode=OneWay, Converter={StaticResource UserColorConverter}}">
					<TextBlock Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" 
                               FontFamily="Webdings" FontSize="110" Foreground="{StaticResource ForegroundLight1ColourBrush}" 
                               Text="_" TextWrapping="Wrap"/>
				</Border>
                
                <!-- SQUARE 3 -->
				<Border Margin="5,5,5,5" Grid.Column="2" BorderBrush="#FF000000" Width="150" Height="150"
                        Background="{Binding UserColor, Mode=OneWay, Converter={StaticResource UserColorConverter}}">
					<TextBlock Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" 
                               FontFamily="Webdings" FontSize="110" Foreground="{StaticResource ForegroundLight1ColourBrush}" 
                               Text="U" TextWrapping="Wrap"/>
				</Border>
                
                <!-- SQUARE 4 -->
                <Border Margin="5,5,5,5" BorderBrush="#FF000000" Height="150" Width="150" Grid.Column="3" 
                        Background="{Binding UserColor, Mode=OneWay, Converter={StaticResource UserColorConverter}}">
                    <TextBlock Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Width="Auto" 
                               FontFamily="Webdings" FontSize="110" Foreground="{StaticResource ForegroundLight1ColourBrush}" 
                               Text="@" TextWrapping="Wrap"/>
				</Border>
			</Grid>
            
            <!-- BODY TEXT -->
			<TextBlock HorizontalAlignment="Left" Margin="18,269,0,0" VerticalAlignment="Top" Width="630" FontFamily="Arial" FontSize="13" TextWrapping="Wrap"><Run Text="This page is state enabled, which means when you navigate away from the page it will store what "/><Run Text="user data is"/><Run Text=" on the page and "/><Run Text="recall "/><Run Text="it when you return"/><Run Text=","/><Run Text=" without storing the page "/><Run Text="itself "/><Run Text="in the memory.  "/><LineBreak/><Run Text=""/><LineBreak/><Run Text="To test, c"/><Run Text="lick on the icons above to change their background"/><Run Text=","/><Run Text=" or "/><Run Text="write anything in the text box below"/><Run Text=" -"/><Run Text=" "/><Run Text="then when you navigate away and open or back up to the same page"/><Run Text=" "/><Run Text="the color and text should be restored"/><Run Text=". "/><Run Text="Note, "/><Run Text="e"/><Run Text="a"/><Run Text="ch blade "/><Run Text="manages its own state"/><Run Text=", and "/><Run Text="the data "/><Run Text="is not persisted over a browser refresh"/><Run Text=" (though you could change that behavior)"/><Run Text="."/></TextBlock>
            
            <!-- BELOW TEXT BOX -->
			<TextBox Height="175" HorizontalAlignment="Left" Margin="20,385,0,0" VerticalAlignment="Top" 
                     Width="630" Background="{x:Null}" HorizontalScrollBarVisibility="Auto" TextWrapping="Wrap" 
                     ScrollViewer.HorizontalScrollBarVisibility="Auto" FontSize="12"
                     Text="{Binding UserText, Mode=TwoWay}"
                     MaxLength="5000" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" 
                     HorizontalContentAlignment="Left" VerticalContentAlignment="Top" 
                     Foreground="{StaticResource BkgDarkColourBrush}" BorderBrush="{StaticResource BkgDarkContrastColourBrush}" >
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="TextChanged">
						<n:UpdateBindingExplicitlyAction PropertyName="Text"/>
					</i:EventTrigger>
				</i:Interaction.Triggers>
			</TextBox>
            
		</Grid>
        
	</ScrollViewer>
    
</UserControl>
